package StudyCode.summary.mycollection;

import java.util.Arrays;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ComputesArrayWiseXOR {
	public static void main(String[] argv) throws Exception {
		byte[] a = new byte[]{34, 35, 36, 37, 37, 37, 67, 68, 69};
		byte[] b = new byte[]{34, 35, 36, 37, 37, 37, 67, 68, 69};
		System.out.println("计算数组阵列 XOR:");
		System.out.println(Arrays.toString(xorArrays(a, b)));
	}

	public static byte[] xorArrays(byte[] a, byte[] b) {
		byte[] xor = new byte[a.length];

		for (int i = 0; i < a.length; i++) {
			xor[i] = (byte) (a[i] ^ b[i]);
		}

		return xor;
	}
}
